package com.bw.zg3.notice.Car1

import androidx.lifecycle.viewModelScope
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import androidx.paging.cachedIn
import com.bw.base.entity.Car1EntityREsultItem
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiServer
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject
@HiltViewModel
class H1ViewModel @Inject constructor(val apiServer: ApiServer):BaseViewModel(){
    fun H1REsult(para:Any,type:String):Flow<PagingData<Car1EntityREsultItem>>{
        return Pager(config = PagingConfig(pageSize = 10), pagingSourceFactory = {
            H1Sure(apiServer,para,type)
        }).flow.cachedIn(viewModelScope)
    }
}